package com.tbit.uqbike.service.business.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tbit.uqbike.object.pojo.PowerChangeMonitorConfig;
import com.tbit.uqbike.service.business.PowerChangeMonitorConfigService;
import com.tbit.uqbike.webmanager.dao.core.PowerChangeMonitorConfigMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author yee_
 * @version 1.0
 * @date 2023/2/20 9:19
 */
@Service
public class PowerChangeMonitorConfigServiceImpl extends ServiceImpl<PowerChangeMonitorConfigMapper, PowerChangeMonitorConfig>
        implements PowerChangeMonitorConfigService {

    @Resource
    private PowerChangeMonitorConfigMapper configMapper;

    @Override
    public boolean updateById(PowerChangeMonitorConfig entity) {
        PowerChangeMonitorConfig config = super.getById(entity.getAccountId());
        if (config == null) {
            super.save(entity);
            return true;
        }
        super.updateById(entity);
        return true;
    }

}
